"""
内容：将根据查询会员名字进行删除设计成一个类 输入会员名字进行查询
作者：赵柚桥
"""
# 引入模块

from ECshop.common.base import Base


# 创建一个根据会员名字进行删除的类
class MemberInquiry(Base):
    # 定义属性
    url = 'http://localhost:8080/ecshop/admin/'
    member_management = ('class name', 'icon-members')
    frame_name_01 = 'menu-frame'
    frame_name_02 = 'main-frame'
    member_username = ('name', 'keyword')
    inquiry_button = ('css selector', 'input[class="button"]')
    member_list = ('css selector', 'a[href="users.php?act=list"]')
    tick = ('css selector', 'table[cellpadding="3"]>tbody>tr>th>input')
    delete_button = ('css selector', 'input[value="删除会员"]')
    # 定义方法

    # 定义方法
    """获取网页"""

    def page_login_open_web(self):
        self.base_open_web(self.url)

    # 进入frame
    def page_in_frame_01(self):
        self.base_in_frame(self.frame_name_01)

    "点击会员管理"

    def page_click_member_management(self):
        self.base_click(self.member_management)

    # 退出frame
    def page_out_frame(self):
        self.base_quit_frame()

    # 再次进入frame
    def page_in_frame_02(self):
        self.base_in_frame(self.frame_name_02)

    """输入会员名字"""

    def page_input_username(self,your_content):
        self.base_input_content(self.member_username, your_content)

    """点击搜索按钮"""

    def page_click_inquiry_button(self):
        self.base_click(self.inquiry_button)

    """点击勾选按钮"""

    def page_click_tick(self):
        self.base_click(self.tick)

    """点击删除按钮"""

    def page_delete_button(self):
        self.base_click(self.delete_button)

    """点击弹窗内的确定"""

    def page_alert(self):
        self.base_alert()

    """关闭"""

    def page_quit(self):
        self.base_quit()


# 创建一个登录页面类
class PageLogin(Base):
    # 定义属性
    url1 = 'http://localhost:8080/ecshop/user.php'
    username = ('name', 'username')
    password = ('name', 'password')
    login_button = ('name', 'submit')
    is_success = ('css selector', 'a[href="user.php"]')

    """进入ecshop的登录页面"""

    def page_login_open_web_01(self):
        self.base_open_web(self.url1)

    """输入用户名"""

    def page_login_input_username(self, my_content):
        self.base_input_content(self.username, my_content)

    """输入密码"""

    def page_login_input_password(self, my_content):
        self.base_input_content(self.password, my_content)

    """点击登录按钮"""

    def page_login_button(self):
        self.base_click(self.login_button)

    """///验证"""

    """获取文本"""
    def page_login_success(self):
        return self.base_get_text(self.is_success)

    """关闭"""

    def page_quit_01(self):
        self.base_quit()
